package com.jinzhi.jzweb.controller.moduleConfig;


import com.baomidou.mybatisplus.plugins.Page;
import com.jinzhi.common.base.BaseController;
import com.jinzhi.common.utils.Result;
import com.jinzhi.jzweb.domain.ExaminationResultsComDO;
import com.jinzhi.jzweb.pojo.ExaminationResultsPoVo;
import com.jinzhi.jzweb.pojo.moduleConfig.OverallStatisticsVo;
import com.jinzhi.jzweb.service.ExaminationResultsComService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

/**
 * 成绩总统计
 * </pre>
 * <small> 2023-05-05 15:11:09 | lance</small>
 */
@Controller
@RequestMapping("/jzweb/examinationAnswerSheetComZongtongji")
@Api(value = "实操居家场景分数统计", tags = {"实操居家场景分数统计"})
public class ExaminationAnswerSheetComZongtongjiController extends BaseController {

    @Autowired
    private ExaminationResultsComService examinationResultsService;


    /**
     * 成绩总统计导出
     *
     * @param response
     */
    @ApiOperation(value = "成绩总统计导出", notes = "成绩总统计导出")
    @GetMapping("/downloadImportStu")
    @RequiresPermissions("jzweb:examinationAnswerSheetComZongtongji:import")
    @ResponseBody
    public void downloadImportTemplate(HttpServletResponse response, ExaminationResultsComDO examinationAnswerSheetComDT) {

        examinationResultsService.overallStatisticsDownloadImport(response,examinationAnswerSheetComDT);
    }

    /**
     * 超级管理员 一级管理员查看分数
     * @param model
     * @return
     */
    @GetMapping()
    @RequiresPermissions("jzweb:examinationAnswerSheetCom:examinationAnswerSheetComZongtongji")
    String info( Model model) {
        return "jzweb/examinationAnswerSheetComZongtongji/examinationAnswerSheetComZongtongji";
    }

    /**
     * 成绩总统计
     * @param examinationAnswerSheetComDTO
     * @return
     */
    @ResponseBody
    @GetMapping("/list")
    @RequiresPermissions("jzweb:examinationAnswerSheetCom:examinationAnswerSheetComZongtongji")
    public Result<Page<OverallStatisticsVo>> list(ExaminationResultsComDO examinationAnswerSheetComDTO){

        return Result.ok(examinationResultsService.overallStatistics(examinationAnswerSheetComDTO));
    }


    /**
     * 成绩公式表导出
     *
     * @param response
     */
    @ApiOperation(value = "成绩公式表导出", notes = "成绩公式表导出")
    @GetMapping("/documentWord")
    @RequiresPermissions("jzweb:examinationAnswerSheetComZongtongji:documentWord")
    @ResponseBody
    public void documentWord(HttpServletResponse response, ExaminationResultsComDO examinationAnswerSheetComDT) throws Exception {

        examinationResultsService.documentWord(response,examinationAnswerSheetComDT);
    }


}
